﻿using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;
using System;

public class MyWindow : MonoBehaviour
{
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
    [DllImport("user32.dll", EntryPoint = "SetWindowPos")]
    private static extern bool SetWindowPos(IntPtr hwnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags);

    [DllImport("user32.dll", EntryPoint = "FindWindow")]
    public static extern IntPtr FindWindow(System.String className, System.String windowName);

    public static void SetPosition(int x, int y, int resX = 0, int resY = 0)
    {
        SetWindowPos(FindWindow(null, "NewRunDog"), 0, x, y, resX, resY, resX * resY == 0 ? 1 : 0);
    }

    // Use this for initialization
    void Awake()
    {
        SetPosition(0, 0);
        Screen.SetResolution(434, 771, false);
        //Screen.SetResolution(640, 480, true);//full screen
    }
#endif
}

